<template>
  <div>
    <!-- 导航栏 -->
    <van-nav-bar title="上传学生证" left-arrow @click-left="onClickLeft"/>

    <!-- 上传文件 -->
    <van-uploader class="uploader-file" :after-read="afterRead" />
  </div>
</template>

<script>
import {uploadFile} from "@/api/user";

export default {
  name: "index",
  data(){
    return{

    }
  },
  methods:{
    /**
     * 返回设置页面
     * */
    onClickLeft(){
      this.$router.push("/user/setting")
    },
    async afterRead(file){
      const from = new FormData();
      from.append("file",file.file)
      let res = await uploadFile(from)
      console.log(res)
    }
  }
}
</script>

<style scoped lang="scss">
</style>
